home *** CD-ROM | disk | FTP | other *** search
- Path: s02.pavilion.co.uk!usenet
- From: AJRobb@pavilion.co.uk (Andy J Robb)
- Newsgroups: comp.lang.c
- Subject: Re: dereferencing pointer to incomplete type
- Date: Mon, 04 Mar 1996 06:52:45 GMT
- Organization: Pavilion Internet plc
- Message-ID: <4he3ud$str@s02.pavilion.co.uk>
- References: <1996Mar3.040741.27234@dcs.warwick.ac.uk>
- NNTP-Posting-Host: poolc19.pavilion.co.uk
- X-Newsreader: Forte Free Agent 1.0.82
-
- D.C.Molero@dcs.warwick.ac.uk (Daniel Castillo Molero) wrote:
-
-
- >Hi everybody.
- >I wonder if anybody can help me to debug the short code below.
- >It is supposed to calculate the area of a polygon, but when I compile
- >it with gcc program.c, it gives me the following errors,
-
- >program.c: In function `calc_area':
- >program.c:22: warning: assignment from incompatible pointer type
- >program.c:24: dereferencing pointer to incomplete type
- >program.c:24: dereferencing pointer to incomplete type
- >program.c:26: warning: assignment from incompatible pointer type
-
-
- >which I don't understand at all.
-
- >I would appreciate very much any sort of help.
-
- >------------------
-
- >struct polygon
- >{
- > int tried;
- > double x, y;
- > int dir, numtimes, conv;
- > struct polyg *next;
-
- Probably should be:
- struct polygon *next;
-
- >};
-
-
- >void triang(double a0, double a1, double b0, double b1, double c0, \
- > double c1, double* result) {
- > *result = a0 * b1 - a1 * b0 + \
- > a1 * c0 - a0 * c1 + \
- > b0 * c1 - c0 * b1;
- >}
-
- >void calc_area(struct polygon* polyg, double* area) {
- >struct polygon* p;
- >double result;
- >p = polyg->next;
- >while (p->next != 0) {
- > triang(polyg->x, polyg->y, p->x, p->y, (p->next)->x, (p->next)->y, &result);
- > *area = *area + result;
- > p = p->next;
- >}
- >}
- >--
- >* Daniel Castillo. danmol@dcs.warwick.ac.uk *
-
-
-
- -----BEGIN PGP PUBLIC KEY BLOCK-----
- Version: 2.6.2i
-
- mQCNAy/MpRwAAAEEAOt6uBYqT8yv9EmqNhK8m6v+bYi8QjnGW3Bo6iU1gsMj5pa6
- MHgq99c8deADbE3cbJ6uZS9v5pZE3WCf6HCQjlB5iULA5RZzMdAumd/WUzuL9UT3
- B44D9EqqFIL79FlYb56v4oKFqFp1/J2bIpYUwnUvabGzGjdLrpPl4P16x9sNAAUR
- tCNBbmR5IEogUm9iYiA8QUpSb2JiQHBhdmlsaW9uLmNvLnVrPrQhQW5keSBSb2Ji
- IDxBSlJvYmJAcGF2aWxpb24uY28udWs+
- =/wVD
- -----END PGP PUBLIC KEY BLOCK-----
-
-